<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base target="center" />
    
    <title>商品管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
	h3{ margin-bottom:0px; margin-left:10px;}
	table{
		width:90%; 
		margin-left:20px; 
		margin-top:25px; 
		border-top:solid 2px #d1b4ab; 
		border-bottom:solid 2px #d1b4ab;
		 border-collapse:collapse;}
	th{ background-color:#eaddd9; color:#925f50; height:30px;}
	td{ border:solid 1px #d1b4ab;}
	.e{ padding-left:5px;}
	.e1{ text-align:center; border-left:none;}
	.e2{ text-align:center; border-right:none;}
	.e3{ text-align:center;}
	.e4{ padding-left:5px; width: 30%}
	.f{border: none; text-align: right;}
	em{ color: red;}
	a:link{ text-decoration:none; color:#00F;}
	a:visited{ text-decoration:underline; color:#90C;}
	a:hover{ text-decoration:underline; color:#F60;}
	a:active{ text-decoration:underline; color:#900;}
</style>

  </head>
  
  <body>
    <h3><img src="img/adsa.png" /> 商品详细信息管理</h3>
	<hr size="2px" color="#ff9933" align="left" width="90%" />
	<table> 
		<tr>
	    	<th>商品编号</th>
	        <th>商品名称</th>
	        <th>所属分类</th>
	        <th>价格</th>
	        <th>剩余数量</th>
	        <th>图片</th>
	        <th>操作</th>
	    </tr>
	    <c:forEach items="${sessionScope.list}" var="bc">
	    <tr>
	    	<td class="e1">${bc.id }</td>
	        <td class="e4">${bc.commodityName }</td>
	        <td class="e">${bc.smallclassName }</td>
	        <td class="e">${bc.sale }</td>
	        <td class="e">${bc.num }</td>
	        <td class="e3"><img src="../${bc.picture }" height="100px" width="100px" /></td>
	        <td class="e2"><a href="../MainServlet?option=update_q&ta=commodity&thisID=${bc.id }">修改</a>
	         <a href="../MainServlet?option=delete&ta=commodity&thisID=${bc.id }&tpage=${sessionScope.tpage}">删除</a></td>
	    </tr>
	    </c:forEach>
	    <tr><td class="f" colspan="7" >
	    	<!-- 分页 -->
		    <b>共有商品<em>${sessionScope.allUser }</em>个</b>&nbsp;&nbsp;
		    <b>当前为<em>${sessionScope.tpage }</em>/<em>${sessionScope.apage }</em>页</b>
		    <!-- 首页 -->
		    <a href="../MainServlet?option=select&ta=commodity&tpage=1">首页</a>
		    <!-- 上一页 -->
		    <c:if test="${sessionScope.tpage>1 }">
				<a href="../MainServlet?option=select&ta=commodity&tpage=${sessionScope.tpage-1 }">上一页</a>    
		    </c:if>
		    <!-- 遍历每一页 -->
		    <c:forEach begin="1" end="${sessionScope.apage}" var="pg">
		 		<a href="../MainServlet?option=select&ta=commodity&tpage=${pg }">${pg }</a>   
		    </c:forEach>
		    <!-- 下一页 -->
		    <c:if test="${sessionScope.tpage<sessionScope.apage }">
				<a href="../MainServlet?option=select&ta=commodity&tpage=${sessionScope.tpage+1 }">下一页</a>    
		    </c:if>
		    <!-- 尾页 -->
		    <a href="../MainServlet?option=select&ta=commodity&tpage=${sessionScope.apage }">尾页</a>
	    </td></tr>
	</table>
  </body>
</html>
